#include <stdio.h>
#include <stdlib.h>
#include <sys/times.h>
#include <unistd.h>
int main()
{
    struct tms t_start_clock,t_end_clock;
    clock_t t_start,t_end,t_total;

    t_start = times(&t_start_clock);
    if (-1 == t_start) {
        perror("times error");
        exit(-1);
    }
    for(int i=0;i<1000;i++)
        ;
    sleep(1);
    t_end = times(&t_end_clock);
    if (-1 == t_end) {
        perror("times error");
        exit(-1);
    }
    t_total = t_end - t_start;
    printf("%ld\n",t_total);

}